<?php
namespace app\index\controller;
use app\common\service\NotionMifiHandler;

class Mqtt{
    
    public function test()
    {
       
        $handler = new NotionMifiHandler();

        // 示例：处理设备上报基本属性
        $reportTopic = 'notion/up/862075034286533/report';
        $reportMessage = '{
            "imei": "862075034286533",
            "token": "",
            "timestamp": "1742786876",
            "data": {
                "sn": "390X16064005390",
                "imsi": "460113469906832",
                "mac": "7c:99:2e:8d:b6:61",
                "iccid": "89861123214044038428",
                "mcc": "460",
                "mnc": "11",
                "software_version": "LBFZAMQTT_N20_MD_LED_2ESIM_V001",
                "ssid": "MIFI-B661",
                "password": "1234567890",
                "wifi_enabled": "1",
                "broadcast_status": "1",
                "encrypt_type": "WPA/WPA2-PSK",
                "max_clients": "10",
                "client_number": "0",
                "upload_speed": "0",
                "download_speed": "0",
                "ul_stats": "95939",
                "dl_stats": "148535",
                "limit_speed": "0",
                "daily_usage": "244582",
                "current_time": "2025-03-24 11:27:56",
                "rsrp": "-87",
                "rsrq": "-10",
                "sinr": "6",
                "rssi": "-55",
                "eci": "6774015",
                "tac": "523C",
                "pci": "343",
                "band": "1",
                "lan_ip": "192.168.1.1",
                "wan_ip": "10.22.100.164",
                "battery": "100",
                "run_time": "39",
                "connect_time": "11",
                "sync_interval": "120",
                "ipv6_enabled": "1",
                "netif_enabled": "1"
            }
        }';
       
        try {
            $result = $handler->handleUpTopic($reportTopic, $reportMessage);
            // 处理解析后的数据
            print_r($result);
        } catch (\Exception $e) {
            echo "Error: " . $e->getMessage();
        }
    }
}

